package com.xiaohai.myfactory;

import com.xiaohai.myInterface.Imessage;

/**
 * 消息工厂类
 */
public class MessageFactory {
    
    
    public static Imessage getInstance(String messClass){
        Imessage imessage = null;
        try {
            imessage = (Imessage) Class.forName(messClass).newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }

        return imessage;
    }
}
